Ext.ns('sid');

Ext.apply(Array.prototype, {
	group: function(property, values) {
		var grouped = [];
		
		Ext.each(this, function(candidate) {
			Ext.each(values, function(value) {
				if (Ext.Array.from(candidate[property]).indexOf(value) > -1) {
					grouped.push(candidate);
				}
			});
		});
		
		return grouped;
	},
	
	select: function(selector) {
		var selected = null;
		
		Ext.each(this, function(current) {
			selected = selector.call(null, current, selected || current);
		});
		
		return selected;
	},
	
	shortest: function() {
		return this.select(function(current, selected) {
			return current.length < selected.length ? current : selected;
		});
	}
});
